package cn.bearspark.happening.provider.dao.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * 动态的内容的数据映射接口
 *
 * @author f
 */
@Mapper
public interface HappeningContentMapper {

    /**
     * 添加动态的内容数据
     *
     * @param happeningId 动态的 id
     * @param content     动态的内容
     */
    @Insert("INSERT INTO t_happening_content (happening_id, content) VALUES (#{happeningId}, #{content})")
    void insert(Long happeningId, String content);

    /**
     * 删除指定动态的内容数据
     *
     * @param happeningId 指定的动态 id
     */
    @Delete("DELETE FROM t_happening_content WHERE happening_id = #{happeningId}")
    void deleteById(long happeningId);

    /**
     * 修改动态的内容
     *
     * @param happeningId 待修改内容的动态 id
     * @param content     待修改的内容
     */
    @Update("UPDATE t_happening_content SET content = #{content} WHERE happening_id = #{happeningId}")
    void update(long happeningId, String content);
}
